/** 写一个防抖函数
 *
 * @param {*} fn
 * @param {*} delay
 * @param {*} immediate
 * @returns
 */

function debounce(fn, delay, immediate) {
  let timer = null;
  let result = null;
  let debounced = function () {
    let context = this;
    let args = arguments;
    if (timer) clearTimeout(timer);
  };
}

/** 写一个节流函数
 *
 * @param {*} fn
 * @param {*} delay
 * @returns
 */
function throttle(fn, delay) {
  let timer = null;
  let result = null;
  let throttled = function () {
    let context = this;
    let args = arguments;
  };
}

// print
console.log("hello,world");

const arr1 = [1, 2, 3, 4, 5];
const arr2 = [1, 2, 3, 4, 5];
const arr3 = [1, 2, 3, 4, 5];
const arr4 = [1, 2, 3, 4, 5];

function arrsUnion(...arrs: Array<number[]>) {
  return [...new Set(arrs.flat())];
}

const result = arrsUnion(arr1, arr2, arr3, arr4);
console.log(result);
